﻿using System;
using System.Globalization;
using System.Windows.Forms;
using System.Linq;
using Styx;
using Styx.Common;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

namespace F2FTraderq
{
    public partial class F2FTraderForm : Form
    {
        public F2FTraderForm()
        {
            InitializeComponent();
        }

        private void BtnSaveClick(object sender, EventArgs e)
        {
            MIRsettings.Instance.Save();
        }

        private void Form1Load(object sender, EventArgs e)
        {
            numTimer.Value = MIRsettings.Instance.PostMessageTimer;
            rtbMessage.Text = MIRsettings.Instance.SendMessage;
            lstItems.SelectedItem = MIRsettings.Instance.SelectedItem;
            numGold.Value = MIRsettings.Instance.Gold;
            numSilver.Value = MIRsettings.Instance.Silver;
            numCopper.Value = MIRsettings.Instance.Copper;
            chkCustomMessage.Checked = MIRsettings.Instance.CustomMessage;
            txtMailboxID.Text = MIRsettings.Instance.MailboxId.ToString(CultureInfo.InvariantCulture);
            chkCOD.Checked = MIRsettings.Instance.Cod;
            chkFace2Face.Checked = MIRsettings.Instance.Face2Face;
            txtCOD1Recipient.Text = MIRsettings.Instance.Cod1Recipient;
            txtCOD1ItemToSend.Text = MIRsettings.Instance.Cod1ItemToSend;
            txtCOD1Gold.Text = MIRsettings.Instance.Cod1AmountGold;
            txtCOD1Silver.Text = MIRsettings.Instance.Cod1AmountSilver;
            txtCOD1Copper.Text = MIRsettings.Instance.Cod1AmountCopper;
            txtCOD2Recipient.Text = MIRsettings.Instance.Cod2Recipient;
            txtCOD2ItemToSend.Text = MIRsettings.Instance.Cod2ItemToSend;
            txtCOD2Gold.Text = MIRsettings.Instance.Cod2AmountGold;
            txtCOD2Silver.Text = MIRsettings.Instance.Cod2AmountSilver;
            txtCOD2Copper.Text = MIRsettings.Instance.Cod2AmountCopper;
            txtCOD3Recipient.Text = MIRsettings.Instance.Cod3Recipient;
            txtCOD3ItemToSend.Text = MIRsettings.Instance.Cod3ItemToSend;
            txtCOD3Gold.Text = MIRsettings.Instance.Cod3AmountGold;
            txtCOD3Silver.Text = MIRsettings.Instance.Cod3AmountSilver;
            txtCOD3Copper.Text = MIRsettings.Instance.Cod3AmountCopper;
            txtCOD4Recipient.Text = MIRsettings.Instance.Cod4Recipient;
            txtCOD4ItemToSend.Text = MIRsettings.Instance.Cod4ItemToSend;
            txtCOD4Gold.Text = MIRsettings.Instance.Cod4AmountGold;
            txtCOD4Silver.Text = MIRsettings.Instance.Cod4AmountSilver;
            txtCOD4Copper.Text = MIRsettings.Instance.Cod4AmountCopper;
            txtCOD5Recipient.Text = MIRsettings.Instance.Cod5Recipient;
            txtCOD5ItemToSend.Text = MIRsettings.Instance.Cod5ItemToSend;
            txtCOD5Gold.Text = MIRsettings.Instance.Cod5AmountGold;
            txtCOD5Silver.Text = MIRsettings.Instance.Cod5AmountSilver;
            txtCOD5Copper.Text = MIRsettings.Instance.Cod5AmountCopper;
            txtCOD6Recipient.Text = MIRsettings.Instance.Cod6Recipient;
            txtCOD6ItemToSend.Text = MIRsettings.Instance.Cod6ItemToSend;
            txtCOD6Gold.Text = MIRsettings.Instance.Cod6AmountGold;
            txtCOD6Silver.Text = MIRsettings.Instance.Cod6AmountSilver;
            txtCOD6Copper.Text = MIRsettings.Instance.Cod6AmountCopper;
            txtCOD7Recipient.Text = MIRsettings.Instance.Cod7Recipient;
            txtCOD7ItemToSend.Text = MIRsettings.Instance.Cod7ItemToSend;
            txtCOD7Gold.Text = MIRsettings.Instance.Cod7AmountGold;
            txtCOD7Silver.Text = MIRsettings.Instance.Cod7AmountSilver;
            txtCOD7Copper.Text = MIRsettings.Instance.Cod7AmountCopper;
            txtCOD8Recipient.Text = MIRsettings.Instance.Cod8Recipient;
            txtCOD8ItemToSend.Text = MIRsettings.Instance.Cod8ItemToSend;
            txtCOD8Gold.Text = MIRsettings.Instance.Cod8AmountGold;
            txtCOD8Silver.Text = MIRsettings.Instance.Cod8AmountSilver;
            txtCOD8Copper.Text = MIRsettings.Instance.Cod8AmountCopper;
            txtCOD9Recipient.Text = MIRsettings.Instance.Cod9Recipient;
            txtCOD9ItemToSend.Text = MIRsettings.Instance.Cod9ItemToSend;
            txtCOD9Gold.Text = MIRsettings.Instance.Cod9AmountGold;
            txtCOD9Silver.Text = MIRsettings.Instance.Cod9AmountSilver;
            txtCOD9Copper.Text = MIRsettings.Instance.Cod9AmountCopper;
            txtCOD10Recipient.Text = MIRsettings.Instance.Cod10Recipient;
            txtCOD10ItemToSend.Text = MIRsettings.Instance.Cod10ItemToSend;
            txtCOD10Gold.Text = MIRsettings.Instance.Cod10AmountGold;
            txtCOD10Silver.Text = MIRsettings.Instance.Cod10AmountSilver;
            txtCOD10Copper.Text = MIRsettings.Instance.Cod10AmountCopper;
            txtCOD11Recipient.Text = MIRsettings.Instance.Cod11Recipient;
            txtCOD11ItemToSend.Text = MIRsettings.Instance.Cod11ItemToSend;
            txtCOD11Gold.Text = MIRsettings.Instance.Cod11AmountGold;
            txtCOD11Silver.Text = MIRsettings.Instance.Cod11AmountSilver;
            txtCOD11Copper.Text = MIRsettings.Instance.Cod11AmountCopper;
            txtCOD12Recipient.Text = MIRsettings.Instance.Cod12Recipient;
            txtCOD12ItemToSend.Text = MIRsettings.Instance.Cod12ItemToSend;
            txtCOD12Gold.Text = MIRsettings.Instance.Cod12AmountGold;
            txtCOD12Silver.Text = MIRsettings.Instance.Cod12AmountSilver;
            txtCOD12Copper.Text = MIRsettings.Instance.Cod12AmountCopper;
            txtCOD13Recipient.Text = MIRsettings.Instance.Cod13Recipient;
            txtCOD13ItemToSend.Text = MIRsettings.Instance.Cod13ItemToSend;
            txtCOD13Gold.Text = MIRsettings.Instance.Cod13AmountGold;
            txtCOD13Silver.Text = MIRsettings.Instance.Cod13AmountSilver;
            txtCOD13Copper.Text = MIRsettings.Instance.Cod13AmountCopper;
            txtCOD14Recipient.Text = MIRsettings.Instance.Cod14Recipient;
            txtCOD14ItemToSend.Text = MIRsettings.Instance.Cod14ItemToSend;
            txtCOD14Gold.Text = MIRsettings.Instance.Cod14AmountGold;
            txtCOD14Silver.Text = MIRsettings.Instance.Cod14AmountSilver;
            txtCOD14Copper.Text = MIRsettings.Instance.Cod14AmountCopper;
            txtCOD15Recipient.Text = MIRsettings.Instance.Cod15Recipient;
            txtCOD15ItemToSend.Text = MIRsettings.Instance.Cod15ItemToSend;
            txtCOD15Gold.Text = MIRsettings.Instance.Cod15AmountGold;
            txtCOD15Silver.Text = MIRsettings.Instance.Cod15AmountSilver;
            txtCOD15Copper.Text = MIRsettings.Instance.Cod15AmountCopper;
            txtCharacterName.Text = MIRsettings.Instance.CharacterName;
            COD1Enabled.Checked = MIRsettings.Instance.Cod1Enabled;
            COD2Enabled.Checked = MIRsettings.Instance.Cod2Enabled;
            COD3Enabled.Checked = MIRsettings.Instance.Cod3Enabled;
            COD4Enabled.Checked = MIRsettings.Instance.Cod4Enabled;
            COD5Enabled.Checked = MIRsettings.Instance.Cod5Enabled;
            COD6Enabled.Checked = MIRsettings.Instance.Cod6Enabled;
            COD7Enabled.Checked = MIRsettings.Instance.Cod7Enabled;
            COD8Enabled.Checked = MIRsettings.Instance.Cod8Enabled;
            COD9Enabled.Checked = MIRsettings.Instance.Cod9Enabled;
            COD10Enabled.Checked = MIRsettings.Instance.Cod10Enabled;
            COD11Enabled.Checked = MIRsettings.Instance.Cod11Enabled;
            COD12Enabled.Checked = MIRsettings.Instance.Cod12Enabled;
            COD13Enabled.Checked = MIRsettings.Instance.Cod13Enabled;
            COD14Enabled.Checked = MIRsettings.Instance.Cod14Enabled;
            COD15Enabled.Checked = MIRsettings.Instance.Cod15Enabled;
            numCOD1MaxStacksSend.Value = MIRsettings.Instance.TbCod1;
            numCOD2MaxStacksSend.Value = MIRsettings.Instance.TbCod2;
            numCOD3MaxStacksSend.Value = MIRsettings.Instance.TbCod3;
            numCOD4MaxStacksSend.Value = MIRsettings.Instance.TbCod4;
            numCOD5MaxStacksSend.Value = MIRsettings.Instance.TbCod5;
            numCOD6MaxStacksSend.Value = MIRsettings.Instance.TbCod6;
            numCOD7MaxStacksSend.Value = MIRsettings.Instance.TbCod7;
            numCOD8MaxStacksSend.Value = MIRsettings.Instance.TbCod8;
            numCOD9MaxStacksSend.Value = MIRsettings.Instance.TbCod9;
            numCOD10MaxStacksSend.Value = MIRsettings.Instance.TbCod10;
            numCOD11MaxStacksSend.Value = MIRsettings.Instance.TbCod11;
            numCOD12MaxStacksSend.Value = MIRsettings.Instance.TbCod12;
            numCOD13MaxStacksSend.Value = MIRsettings.Instance.TbCod13;
            numCOD14MaxStacksSend.Value = MIRsettings.Instance.TbCod14;
            numCOD15MaxStacksSend.Value = MIRsettings.Instance.TbCod15;
            COD1Ready.Checked = MIRsettings.Instance.Cod1Ready;
            COD2Ready.Checked = MIRsettings.Instance.Cod2Ready;
            COD3Ready.Checked = MIRsettings.Instance.Cod3Ready;
            COD4Ready.Checked = MIRsettings.Instance.Cod4Ready;
            COD5Ready.Checked = MIRsettings.Instance.Cod5Ready;
            COD6Ready.Checked = MIRsettings.Instance.Cod6Ready;
            COD7Ready.Checked = MIRsettings.Instance.Cod7Ready;
            COD8Ready.Checked = MIRsettings.Instance.Cod8Ready;
            COD9Ready.Checked = MIRsettings.Instance.Cod9Ready;
            COD10Ready.Checked = MIRsettings.Instance.Cod10Ready;
            COD11Ready.Checked = MIRsettings.Instance.Cod11Ready;
            COD12Ready.Checked = MIRsettings.Instance.Cod12Ready;
            COD13Ready.Checked = MIRsettings.Instance.Cod13Ready;
            COD14Ready.Checked = MIRsettings.Instance.Cod14Ready;
            COD15Ready.Checked = MIRsettings.Instance.Cod15Ready;
            chkAdvertise.Checked = MIRsettings.Instance.BtnAdvertise;
            numTimer.Value = MIRsettings.Instance.PostMessageTimer;
            MIRsettings.Instance.Load();
        }

        private void TxtMailboxIDTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.MailboxId = Convert.ToUInt32(txtMailboxID.Text);
        }
        private void BtnGetNearestMailboxEntryIDClick(object sender, EventArgs e)
        {
            try
            {
                var mailboxes = ObjectManager.GetObjectsOfType<WoWGameObject>(false, false).Where(
                    o => o != null && o.Distance < 6 && o.Name == "Mailbox").ToList();
                foreach (WoWGameObject obj in mailboxes.Where(obj => obj != null).Where(obj => obj.Distance < 6))
                {
                    txtMailboxID.Text = obj.Entry.ToString(CultureInfo.InvariantCulture);
                    new Main().Info("Added Nearest Mailbox: " + obj.Entry.ToString(CultureInfo.InvariantCulture));
                }
            }
            catch(Exception a)
            {
                new Main().Warning("Error: " + a.Message);
            }
        }

        private void ChkCodCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod = chkCOD.Checked;
        }

        private void ChkFace2FaceCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Face2Face = chkFace2Face.Checked;
        }

        private void TxtCOD1RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1Recipient = txtCOD1Recipient.Text;
        }

        private void TxtCOD1ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1ItemToSend = txtCOD1ItemToSend.Text;
        }

        private void TxtCOD1GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1AmountGold = txtCOD1Gold.Text;
        }

        private void TxtCOD1SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1AmountSilver = txtCOD1Silver.Text;
        }

        private void TxtCOD1CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1AmountCopper = txtCOD1Copper.Text;
        }

        private void TxtCOD2RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2Recipient = txtCOD2Recipient.Text;
        }

        private void TxtCOD2ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2ItemToSend = txtCOD2ItemToSend.Text;
        }

        private void TxtCOD2GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2AmountGold = txtCOD2Gold.Text;
        }

        private void TxtCOD2SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2AmountSilver = txtCOD2Silver.Text;
        }

        private void TxtCOD2CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2AmountCopper = txtCOD2Copper.Text;
        }

        private void TxtCOD3RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3Recipient = txtCOD3Recipient.Text;
        }

        private void TxtCOD3ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3ItemToSend = txtCOD3ItemToSend.Text;
        }

        private void TxtCOD3GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3AmountGold = txtCOD3Gold.Text;
        }

        private void TxtCOD3SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3AmountSilver = txtCOD3Silver.Text;
        }

        private void TxtCOD3CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3AmountCopper = txtCOD3Copper.Text;
        }

        private void TxtCOD4RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4Recipient = txtCOD4Recipient.Text;
        }

        private void TxtCOD4ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4ItemToSend = txtCOD4ItemToSend.Text;
        }

        private void TxtCOD4GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4AmountGold = txtCOD4Gold.Text;
        }

        private void TxtCOD4SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4AmountSilver = txtCOD4Silver.Text;
        }

        private void TxtCOD4CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4AmountCopper = txtCOD4Copper.Text;
        }

        private void TxtCOD5RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5Recipient = txtCOD5Recipient.Text;
        }

        private void TxtCOD5ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5ItemToSend = txtCOD5ItemToSend.Text;
        }

        private void TxtCOD5GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5AmountGold = txtCOD5Gold.Text;
        }

        private void TxtCOD5SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5AmountSilver = txtCOD5Silver.Text;
        }

        private void TxtCOD5CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5AmountCopper = txtCOD5Copper.Text;
        }

        private void TxtCOD6RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6Recipient = txtCOD6Recipient.Text;
        }

        private void TxtCOD6ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6ItemToSend = txtCOD6ItemToSend.Text;
        }

        private void TxtCOD6GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6AmountGold = txtCOD6Gold.Text;
        }

        private void TxtCOD6SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6AmountSilver = txtCOD6Silver.Text;
        }

        private void TxtCOD6CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6AmountCopper = txtCOD6Copper.Text;
        }

        private void TxtCOD7RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7Recipient = txtCOD7Recipient.Text;
        }

        private void TxtCOD7ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7ItemToSend = txtCOD7ItemToSend.Text;
        }

        private void TxtCOD7GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7AmountGold = txtCOD7Gold.Text;
        }

        private void TxtCOD7SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7AmountSilver = txtCOD7Silver.Text;
        }

        private void TxtCOD7CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7AmountCopper = txtCOD7Copper.Text;
        }

        private void TxtCOD8RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8Recipient = txtCOD8Recipient.Text;
        }

        private void TxtCOD8ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8ItemToSend = txtCOD8ItemToSend.Text;
        }

        private void TxtCOD8GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8AmountGold = txtCOD8Gold.Text;
        }

        private void TxtCOD8SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8AmountSilver = txtCOD8Silver.Text;
        }

        private void TxtCOD8CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8AmountCopper = txtCOD8Copper.Text;
        }

        private void TxtCOD9RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9Recipient = txtCOD9Recipient.Text;
        }

        private void TxtCOD9ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9ItemToSend = txtCOD9ItemToSend.Text;
        }

        private void TxtCOD9GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9AmountGold = txtCOD9Gold.Text;
        }

        private void TxtCOD9SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9AmountSilver = txtCOD9Silver.Text;
        }

        private void TxtCOD10RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10Recipient = txtCOD10Recipient.Text;
        }

        private void TxtCOD10ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10ItemToSend = txtCOD10ItemToSend.Text;
        }

        private void TxtCOD10GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10AmountGold = txtCOD10Gold.Text;
        }

        private void TxtCOD10SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10AmountSilver = txtCOD10Silver.Text;
        }

        private void TxtCOD10CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10AmountCopper = txtCOD10Copper.Text;
        }

        private void TxtCOD11RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11Recipient = txtCOD11Recipient.Text;
        }

        private void TxtCOD11ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11ItemToSend = txtCOD11ItemToSend.Text;
        }

        private void TxtCOD11GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11AmountGold = txtCOD11Gold.Text;
        }

        private void TxtCOD11SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11AmountSilver = txtCOD11Silver.Text;
        }

        private void TxtCOD11CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11AmountCopper = txtCOD11Copper.Text;
        }

        private void TxtCOD12RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12Recipient = txtCOD12Recipient.Text;
        }

        private void TxtCOD12ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12ItemToSend = txtCOD12ItemToSend.Text;
        }

        private void TxtCOD12GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12AmountGold = txtCOD12Gold.Text;
        }

        private void TxtCOD12SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12AmountSilver = txtCOD12Silver.Text;
        }

        private void TxtCOD12CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12AmountCopper = txtCOD12Copper.Text;
        }

        private void TxtCOD13RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13Recipient = txtCOD13Recipient.Text;
        }

        private void TxtCOD13ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13ItemToSend = txtCOD13ItemToSend.Text;
        }

        private void TxtCOD13GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13AmountGold = txtCOD13Gold.Text;
        }

        private void TxtCOD13SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13AmountSilver = txtCOD13Silver.Text;
        }

        private void TxtCOD13CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13AmountCopper = txtCOD13Copper.Text;
        }

        private void TxtCOD14RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14Recipient = txtCOD14Recipient.Text;
        }

        private void TxtCOD14ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14ItemToSend = txtCOD14ItemToSend.Text;
        }

        private void TxtCOD14GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14AmountGold = txtCOD14Gold.Text;
        }

        private void TxtCOD14SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14AmountSilver = txtCOD14Silver.Text;
        }

        private void TxtCOD14CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14AmountCopper = txtCOD14Copper.Text;
        }

        private void TxtCOD15RecipientTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15Recipient = txtCOD15Recipient.Text;
        }

        private void TxtCOD15ItemToSendTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15ItemToSend = txtCOD15ItemToSend.Text;
        }

        private void TxtCOD15GoldTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15AmountGold = txtCOD15Gold.Text;
        }

        private void TxtCOD15SilverTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15AmountSilver = txtCOD15Silver.Text;
        }

        private void TxtCOD15CopperTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15AmountCopper = txtCOD15Copper.Text;
        }

        private void COD1EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1Enabled = COD1Enabled.Checked;
        }

        private void COD2EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2Enabled = COD2Enabled.Checked;
        }

        private void COD3EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3Enabled = COD3Enabled.Checked;
        }

        private void COD4EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4Enabled = COD4Enabled.Checked;
        }

        private void COD5EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5Enabled = COD5Enabled.Checked;
        }

        private void COD6EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6Enabled = COD6Enabled.Checked;
        }

        private void COD7EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7Enabled = COD7Enabled.Checked;
        }

        private void COD8EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8Enabled = COD8Enabled.Checked;
        }

        private void COD9EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9Enabled = COD9Enabled.Checked;
        }

        private void COD10EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10Enabled = COD10Enabled.Checked;
        }

        private void COD11EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11Enabled = COD11Enabled.Checked;
        }

        private void COD12EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12Enabled = COD12Enabled.Checked;
        }

        private void COD13EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13Enabled = COD13Enabled.Checked;
        }

        private void COD14EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14Enabled = COD14Enabled.Checked;
        }

        private void COD15EnabledCheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15Enabled = COD15Enabled.Checked;
        }

        private void BtnMainSaveClick(object sender, EventArgs e)
        {
            MIRsettings.Instance.Save();
        }

        private void BtnCODSaveClick(object sender, EventArgs e)
        {
            MIRsettings.Instance.Save();
        }

        private void TxtCharacterNameTextChanged(object sender, EventArgs e)
        {

            MIRsettings.Instance.CharacterName = txtCharacterName.Text;
        }

        private void BtnAdvertiseSaveClick(object sender, EventArgs e)
        {
            MIRsettings.Instance.Save();
        }

        private void LstItemsSelectedIndexChanged(object sender, EventArgs e)
        {
            var items = (StyxWoW.Me.BagItems.Where(item => item != null).Select(
                item => "Name: " + item.Name + ", " + "ID: " + item.Entry + Environment.NewLine)).ToList();
            lstItems.DataSource = items.Distinct().ToList();
        }

        private void RtbMessageTextChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.SendMessage = rtbMessage.Text;
        }

        private void BtnItemsClick(object sender, EventArgs e)
        {
            ObjectManager.Update();
            try
            {
                var items = (StyxWoW.Me.BagItems.Where(item => item != null).Select(
                    item => "Name: " + item.Name + ", " + "ID: " + item.Entry + Environment.NewLine)).ToList();
                lstItems.DataSource = items.Distinct().ToList();
            }
            catch (Exception)
            {
                Logging.Write("Error: Unable to find objects, but keep clicking it should work eventually...");
            }
        }

        private void chkAdvertise_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.BtnAdvertise = chkAdvertise.Checked;
        }

        private void numGold_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Gold = (int) numGold.Value;
        }

        private void numSilver_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Silver = (int) numSilver.Value;
        }

        private void numCopper_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Copper = (int) numCopper.Value;
        }

        private void chkPostManual_Click(object sender, EventArgs e)
        {
            if (!MIRsettings.Instance.CustomMessage)
                new Main().PostManualDefaultMessage();
            else
                new Main().PostManualCustomMessage();
        }

        private void COD_Click(object sender, EventArgs e)
        {

        }

        private void groupBox17_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox19_Enter(object sender, EventArgs e)
        {

        }

        private void numTimer_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.PostMessageTimer = (int) numTimer.Value;
        }

        private void chkCustomMessage_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.CustomMessage = chkCustomMessage.Checked;
        }

        private void numMaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod1 = (int) numCOD1MaxStacksSend.Value;
        }

        private void numCOD2MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod2 = (int)numCOD2MaxStacksSend.Value;
        }

        private void label11_Click(object sender, EventArgs e)
        {

        }

        private void label42_Click(object sender, EventArgs e)
        {

        }

        private void numCOD3MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod3 = (int)numCOD3MaxStacksSend.Value;
        }

        private void numCOD4MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod4 = (int)numCOD4MaxStacksSend.Value;
        }

        private void numCOD5MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod5 = (int)numCOD5MaxStacksSend.Value;
        }

        private void numCOD6MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod6 = (int)numCOD6MaxStacksSend.Value;
        }

        private void numCOD7MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod7 = (int)numCOD7MaxStacksSend.Value;
        }

        private void numCOD8MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod8 = (int)numCOD8MaxStacksSend.Value;
        }

        private void numCOD9MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod9 = (int)numCOD9MaxStacksSend.Value;
        }

        private void numCOD10MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod10 = (int)numCOD10MaxStacksSend.Value;
        }

        private void numCOD11MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod11 = (int)numCOD11MaxStacksSend.Value;
        }

        private void numCOD12MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod12 = (int)numCOD12MaxStacksSend.Value;
        }

        private void numCOD13MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod13 = (int)numCOD13MaxStacksSend.Value;
        }

        private void numCOD14MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod14 = (int)numCOD14MaxStacksSend.Value;
        }

        private void numCOD15MaxStacksSend_ValueChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.TbCod15 = (int)numCOD15MaxStacksSend.Value;

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void COD1Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod1Ready = COD1Ready.Checked;
        }

        private void COD2Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod2Ready = COD2Ready.Checked;
        }

        private void COD3Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod3Ready = COD3Ready.Checked;
        }

        private void COD4Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod4Ready = COD4Ready.Checked;
        }

        private void COD5Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod5Ready = COD5Ready.Checked;
        }

        private void COD6Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod6Ready = COD6Ready.Checked;
        }

        private void COD7Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod7Ready = COD7Ready.Checked;
        }

        private void COD8Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod8Ready = COD8Ready.Checked;
        }

        private void COD9Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod9Ready = COD9Ready.Checked;
        }

        private void COD10Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod10Ready = COD10Ready.Checked;
        }

        private void COD11Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod11Ready = COD11Ready.Checked;
        }

        private void COD12Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod12Ready = COD12Ready.Checked;
        }

        private void COD13Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod13Ready = COD13Ready.Checked;
        }

        private void COD14Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod14Ready = COD14Ready.Checked;
        }

        private void COD15Ready_CheckedChanged(object sender, EventArgs e)
        {
            MIRsettings.Instance.Cod15Ready = COD15Ready.Checked;
        }
    }
}
